<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>外边距合并</title>
    <style>
        div {
            width: 400px;
            height: 400px;
            background-color: red;
            margin-top: 50px;
            /* 1.为父元素定义边框 */
            /* border: 3px solid transparent; */
            /* 2.为父元素定义内边距 */
            /* padding-top: 1px; */
            /* 3.为父元素定义overflow：hidden */
            /* overflow: hidden; */
        }

        p {
            width: 200px;
            height: 200px;
            background-color: pink;
            margin-top: 30px;
        }
    </style>
</head>

<body>
    <div>
        <p>

        </p>
    </div>
</body>

</html>